{extend name="admin@public/base_content" /}
<!-- 内容区域开始 <div class="row-content am-cf">-->
{block name="body">}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                {include file="admin@public/common" /}
                <div class="widget-body  am-fr">
                    <div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
                        <form method="post" action="{url()}">
                            <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                  <input type="text" name="keyword" value="{$pageMaps.keyword|default=''}" placeholder="关键词" class="am-form-field ">
                                  <span class="am-input-group-btn">
                                    <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="submit"></button>
                                  </span>
                            </div>
                        </form>
                    </div>
                    <form method="post" action="{url()}">
                        <div class="am-u-sm-2 am-u-md-2 am-u-lg-2">
                            <div class="am-form-group tpl-table-list-select">
                                <select data-am-selected="{btnSize: 'sm',maxHeight: 400}" name="class_id" id="class_id">
                                    <option value="0">选择栏目</option>
                                    {foreach name="categoryList" item="vo"}
                                    <option value="{$vo.class_id}" {if condition="$pageMaps.class_id eq $vo.class_id"} selected{/if}>{$vo.cname}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-2 am-u-md-2 am-u-lg-2">
                            <div class="am-form-group tpl-table-list-select">
                                <select data-am-selected="{btnSize: 'sm',maxHeight: 400}" name="position_id" id="position_id">
                                    <option value="0">选择推荐位</option>
                                    {foreach name="positionList" item="vo"}
                                    <option value="{$vo.position_id}" {if condition="$pageMaps.position_id eq $vo.position_id"} selected{/if}>{$vo.name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-2 am-u-md-2 am-u-lg-2">
                            <div class="am-form-group tpl-table-list-select">
                                <select data-am-selected="{btnSize: 'sm',maxHeight: 400}" name="status">
                                    <option value="0">选择状态</option>
                                    <option value="1" {eq name="pageMaps.status" value="1"}selected{/eq}>发布</option>
                                    <option value="2" {eq name="pageMaps.status" value="2"}selected{/eq}>未发布</option>
                                </select>
                            </div>
                        </div>
                        <div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
                            <div class="am-form-group">
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs am-dropdown" data-am-dropdown>
                                        <button type="submit" class="am-btn am-btn-warning"><span class="am-icon-plus"></span> 筛选</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                            <tr>
                                <th class="table-id">ID</th>
                                <th>标题</th>
                                <th>栏目</th>
                                <th>状态</th>
                                <th>更新时间</th>
                                <th width="120px" style="text-align:center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach name="list" item="vo"}
                            <tr class="gradeX">
                                <td align="center"><span>{$vo.content_id}</span></td>
                                <td>{$vo.title}</td>
                                <td>{$vo.class_name}</td>
                                <td>
                                    {if condition="$vo.status eq 1"}
                                    <i class="am-icon-check am-text-warning"></i>
                                    {else /}
                                    <i class="am-icon-close am-text-primary"></i>
                                    {/if}
                                </td>
                                <td>{$vo.time}</td>
                                <td>
                                    <div class="tpl-table-black-operation">
                                        <a href="{:url('edit',array('id'=>$vo.content_id))}">
                                            <i class="am-icon-pencil"></i> 编辑
                                        </a>
                                        <a href="javascript:;" class="tpl-table-black-operation-del" onclick="del(this,'{$vo.content_id}','{:url(\'del\')}')">
                                            <i class="am-icon-trash"></i> 删除
                                        </a>
                                    </div>
                                </td>
                            </tr>
                            {/foreach}
                            <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <!--分页开始-->
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr">
                            {$_page}
                            <!--<ul class="am-pagination tpl-pagination">
                                <li class="am-disabled"><a href="#">«</a></li>
                                <li class="am-active"><a href="#">1</a></li>
                                <li><a href="#">2</a></li>
                                <li><a href="#">3</a></li>
                                <li><a href="#">4</a></li>
                                <li><a href="#">5</a></li>
                                <li><a href="#">»</a></li>
                            </ul>-->
                        </div>
                    </div>
                    <!--分页结束-->
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
<!-- 内容区域结束 -->
<!-- 脚本文件开始 -->
{block name="script"}
<script>
    /**
     * 删除操作
     */
    function del(obj,id,url) {
        //此处请求后台程序，下方是成功后的前台处理……
        if(confirm("确定要删除吗？")) {
            $.post(url, {
                id: id,
            }, function (data) {
                //console.log(data);
                if (data.code == 1) {
                    $(obj).parents("tr").remove();
                } else {
                    di_alert(data.msg,2);
                }
            })
        }
    }
</script>
{/block}
<!-- 脚本文件结束 -->